/* 
 * BAT_Validator.h
 *
 * Data structure validator for BAT.
 *
 * $Id: BAT_Validator.h 931 2006-09-05 09:42:04Z rpz $
 *
 * Bob Zimmermann <rpz@cse.wustl.edu>
 *
 */

#include "config.h"
#include "BAT_Annotation.h"
#include "BAT_Builder.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <getopt.h> /* solaris doesn't have getopt.h, so we can use unistd.h */

#ifndef BAT_VALIDATOR_H
#  define BAT_VALIDATOR_H

typedef struct _BAT_Validator BAT_Validator;
typedef struct _BAT_Validate_Plugin BAT_Validate_Plugin;
typedef struct _BAT_Sub_Validator_Handle BAT_Sub_Validator_Handle;

typedef enum _BAT_Validator_Type
{
  BAT_GeneID_Validator_Type
} BAT_Validator_Type;

typedef void *(*V_ConstructF) (void);
typedef void (*V_DeleteF) (void *, int);
typedef int (*V_Cmd_Parser) (void *, int, char **);
typedef BAT_GeneTab *(*V_GeneTab_ValidatorF) (void *, BAT_GeneTab *);
typedef BAT_Gene *(*V_Gene_ValidatorF) (void *, BAT_Gene *);
typedef BAT_Transcript *(*V_Transcript_ValidatorF) (void *, BAT_Transcript *);
typedef BAT_Feature *(*V_Feature_ValidatorF) (void *, BAT_Feature *);

struct _BAT_Validate_Plugin
{
  BAT_Validator_Type type;
  char name[20];
  char command[10];
  char help[80];
  char longhelp[4096];
  V_ConstructF construct;
  V_DeleteF delete;
  V_Cmd_Parser cmdparse;
  V_GeneTab_ValidatorF batv;
  V_Gene_ValidatorF genev;
  V_Transcript_ValidatorF txv;
  V_Feature_ValidatorF vfeatv;
};

struct _BAT_Sub_Validator_Handle
{
  BAT_Validate_Plugin *plugin;
  void *obj;
};

struct _BAT_Validator
{
  /* We use the factory to get all our plugins. They turn themselves on or off
   * depending on the passed commands */
  BAT_GeneTab *bat;
  darray_t *handles;
};

BAT_Validator *BAT_Validator_new ();
int BAT_Validator_add_command (BAT_Validator *, char *);
void BAT_Validator_delete (BAT_Validator *, int);
BAT_GeneTab *BAT_Validator_validate_gene_table (BAT_Validator *, BAT_GeneTab *);

#endif /* BAT_VALIDATOR */
